﻿function HomeController($scope, $http) {
    var vm = this;
    vm.username = '';
    vm.password = '';

    vm.login = function () {
        $http({
            url: '/Token',
            method: 'POST',
            contentType: 'application/x-www-form-urlencoded',
            data: 'username=' + vm.username + '&password=' + vm.password + '&grant_type=password'
        }).success(function (data) {
            sessionStorage.setItem('token', data.access_token);
        }).error(function () {

        });
    };
}

HomeController.$inject = ['$scope', '$http'];